# 怪物类
class Monster:

    # 新建怪物
    def __init__(self, name, rank=1, attack=1.25, blood_volume=10, defend=1, experience=50, skills=None,
                 skills_probability=0.1, is_boss=False):
        self.name = name
        self.rank = rank
        factor = rank / 50
        if factor < 1:
            factor = 1
        if rank > 150:
            factor += rank / 20
        if is_boss:
            factor *= 1.5

        self.attack = attack * rank * factor
        self.blood_volume = blood_volume * rank * factor
        self.defend = defend * rank * factor
        self.experience = experience * rank * factor  # 掉落经验
        self.skills = skills  # 掉落技能
        self.skills_probability = skills_probability * rank  # 掉落技能概率
        self.is_boss = is_boss

    def print_state(self):
        print('----------------------------------------------------')
        print("\033[0;34;40m怪物属性\033[0m")  # 蓝色
        str_skills = '无'
        if self.skills is not None and len(self.skills) > 0:
            str_skills = ''
            for i in self.skills:
                str_skills += str(i.name) + ' '
        boss_str = ''
        if self.is_boss:
            boss_str = '（BOSS）'
        print('怪物名：' + self.name + boss_str + '\n等级：' + str(self.rank) + '\n攻击力：' + str(self.attack) + '\n血量：' + str(
            self.blood_volume) + '\n防御力：' + str(self.defend) + '\n经验值:' + str(self.experience) + '\n技能：' + str_skills)
